Skip to main content

How do you get and use a Refresh Token for the Dropbox API (Python 3.x)

  1. Replace <APP_KEY> with your dropbox app key in the below Authorization URL
https://www.dropbox.com/oauth2/authorize?client_id=<APP_KEY>&token_access_type=offline&response_type=code
  1. Complete the code flow on the Authorization URL. You will receive an AUTHORIZATION_CODE at the end.

  2. Go to Postman and create a new POST request with below configuration

KeyValue
code<AUTHORIZATION_CODE>
grant_typeauthorization_code
  1. After you send the request, you will receive JSON payload containing refresh_token.
{
"access_token": "sl.****************",
"token_type": "bearer",
"expires_in": 14400,
"refresh_token": "*********************",
"scope": <SCOPES>,
"uid": "**********",
"account_id": "***********************"
}
  1. In your python application
import dropbox

dbx = dropbox.Dropbox(
app_key = <APP_KEY>,
app_secret = <APP_SECRET>,
oauth2_refresh_token = <REFRESH_TOKEN>
)

REF